Hệ thống quản lý nguồn nhân lực Dự án năm cuối trong c#
- Frm_Employee_Performance.vb
- project /
1 Public Class Frm_Employee_Performance
2
3 Public Shared emp_id = 0
4 Dim monthName As String = String.Empty
5
6 Private Function employeePerformance(ByVal employeeID As Integer, ByVal monthName As String) As DataTable
7
8 Dim query = "Select E.employee_id , E.full_name, P.performance_id, P." & monthName
9 query = query & " From Employee_Performance_Table Ept"
10 query = query & " Inner Join Employee E on E.employee_id = Ept.employee_id"
11 query = query & " Inner Join Performance P on P.performance_id = Ept.performance_id"
12 query = query & " Where E.employee_id ='" & employeeID & "'"
13
14 Return getDataTable(query)
15
16 End Function
17
18 Private Sub showPerfInDataGrid()
19
20 Dim dt As DataTable = employeePerformance(emp_id, monthName)
21
22 dgvPerformance.Rows.Clear()
23
24 For Each row As DataRow In dt.Rows
25
26 dgvPerformance.Rows.Add()
27 dgvPerformance.Rows(dgvPerformance.RowCount - 1).Cells("PerfID").Value = row("performance_id")
28 dgvPerformance.Rows(dgvPerformance.RowCount - 1).Cells("EmpID").Value = row("employee_id")
29 dgvPerformance.Rows(dgvPerformance.RowCount - 1).Cells("EmpName").Value = row("full_name")
30 dgvPerformance.Rows(dgvPerformance.RowCount - 1).Cells("PerfMonth").Value = row(monthName)
31
32 Next
33
34 End Sub
35
36 Private Sub cmboxMonths2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmboxMonths2.SelectedIndexChanged
37
38 If cmboxMonths2.Text.Equals("January") Then
39
40 monthName = "perf_january"
41
42 ElseIf cmboxMonths2.Text.Equals("Feburary") Then
43
44 monthName = "perf_feburary"
45
46 ElseIf cmboxMonths2.Text.Equals("March") Then
47
48 monthName = "perf_march"
49
50 ElseIf cmboxMonths2.Text.Equals("April") Then
51
52 monthName = "perf_april"
53
54 ElseIf cmboxMonths2.Text.Equals("May") Then
55
56 monthName = "perf_may"
57
58 ElseIf cmboxMonths2.Text.Equals("June") Then
59
60 monthName = "perf_june"
61
62 ElseIf cmboxMonths2.Text.Equals("July") Then
63
64 monthName = "perf_july"
65
66 ElseIf cmboxMonths2.Text.Equals("August") Then
67
68 monthName = "perf_august"
69
70 ElseIf cmboxMonths2.Text.Equals("September") Then
71
72 monthName = "perf_september"
73
74 ElseIf cmboxMonths2.Text.Equals("October") Then
75
76 monthName = "perf_october"
77
78 ElseIf cmboxMonths2.Text.Equals("November") Then
79
80 monthName = "perf_november"
81
82 ElseIf cmboxMonths2.Text.Equals("December") Then
83
84 monthName = "perf_december"
85
86 End If
87
88 End Sub
89
90 Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
91
92 Me.Close()
93
94 End Sub
95
96 Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
97 showPerfInDataGrid()
98 End Sub
99 End Class